home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-22 | 2.1 KB | 49 lines | [TEXT/X_#9] |
- ; Tutorial 2: Basic 2D objects
- ;
- ; From Tutorial 1, you know about the basic objects "square",
- ; "circle" and "line". xModels-2D also lets you use circles and
- ; squares filled in with either white, black, or gray color.
- ; The commands for these objects are whitecircle, blackcircle,
- ; graycircle, whitesquare, blacksquare, and graysquare. The
- ; difference between a "whitesquare" and a plain "square" is
- ; that anything behind the whitesquare will be hidden. For
- ; example:
-
- blackcircle scale 2 translate -7,7
- graysquare scale 3 rotate 30 translate 6,6
- whitecircle scale 2 translate 7,7
-
- ; You can also draw "polygon objects". To make a polygon, you
- ; need a list of points. Each point has two coordinates. The
- ; polygon is made by connecting each point in the list to the
- ; with a line. A line is also drawn from the last point back to
- ; the first. For example:
-
- polygon 3,1 0,6 -2,-2 ; a triangle with vertices
- ; (3,1), (0,6), and (-2,2)
-
- ; Since there are three pairs of numbers, you get a three-sided
- ; figure, that is, a triangle. (If you specify a polygon with
- ; just two points, it will be a single line segment. This is a
- ; convenient way to draw the line between two given points.)
- ;
- ; SYNTAX NOTE: Commas are included for readability, but the program
- ; treats them exactly like spaces. This is true in all contexts.
- ; For example, "translate 6,6" and "translate 6 6" are equivalent.
- ;
- ; There are filled-in polygons, given by graypolygon, whitepolygon,
- ; and blackpolygon. You can apply transformations to polygons
- ; just as to any other objects:
-
- graypolygon 0,0 3,0 1,1 0,3 ; an "arrowhead" shape
- rotate 40 ; rotated 40 degrees
- translate 0,-7 ; then moved down 7 units
-
- ; SYNTAX NOTE: It doesn't matter how you lay out a scene
- ; description on a page. You can insert comments, carriage returns,
- ; and empty spaces at will. The computer only reads the words and
- ; numbers and doesn't care about formating.
- ;
- ; Render this file to see the five objects that are specified.
- ; Try to understand where each object comes from.
-